﻿
@{
    ViewData["Title"] = "收获地址编辑";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 class="mui-title">收获地址编辑</h1>
    <a class="mui-icon mui-icon-checkmarkempty mui-pull-right">保存</a>
</header>
<div class="mui-content">
    <div class="mui-content-padded" style="margin: 5px;">
        <h5>收货人</h5>
        <div class="mui-input-row mui-password">
            <input type="text" class="mui-input-clear">
        </div>
        <h5>手机号码</h5>
        <div class="mui-input-row mui-password">
            <input type="text" class="mui-input-clear">
        </div>
        <h5>所在地区</h5>
        <div class="mui-input-row mui-password">
            <input type="text" class="mui-input-clear">
        </div>
        <div class="mui-input-row" style="margin: 10px 5px;">
            <h5>详细地址</h5>
            <textarea id="textarea" rows="5" class="mui-input-clear" placeholder="详细地址"></textarea>
        </div>
        <div class="mui-input-row">
            <span>设为默认</span>
            <input type="hidden" id="defaultAddress" value="false"/>
            <div class="mui-switch mui-switch-blue">
                <div class="mui-switch-handle"></div>
            </div>
        </div>
        <button type="button" class="mui-btn mui-btn-primary mui-btn-block">保存</button>
    </div>
</div>
<script>
    mui.init({
        swipeBack: true
    });
    mui('.mui-input-row .mui-switch').each(function () { 
        this.parentNode.querySelector('span').innerText = '设为默认：';
        this.addEventListener('toggle', function (event) {
            this.parentNode.querySelector('span').innerText = '设为默认：';
            $("#defaultAddress").val((event.detail.isActive ? 'true' : 'false'));
        });
    });
</script>